package com.lanhe.member.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lanhe.member.domain.LhMemberRevenueRec;
import com.lanhe.member.mapper.LhMemberRevenueRecMapper;
import com.lanhe.member.service.ILhMemberRevenueRecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 用户收益记录(LhMemberRevenueRec)表服务实现类
 *
 * @author zhanggl
 * @since 2023-12-27 10:09:57
 */
@Service
public class LhMemberRevenueRecServiceImpl extends ServiceImpl<LhMemberRevenueRecMapper, LhMemberRevenueRec> implements ILhMemberRevenueRecService {

	@Autowired
	private LhMemberRevenueRecMapper memberRevenueRecordsMapper;

	/**
	 * 增加用户收益
	 *
	 * @param memberRevenueRecords 实体
	 * @return int
	 * @author zhanggl
	 * @date 2023/12/27
	 */
	@Override
	public int insertMemberRevenueRecords(LhMemberRevenueRec memberRevenueRecords) {

		memberRevenueRecords.setCreateTime(new Date());
		return memberRevenueRecordsMapper.insert(memberRevenueRecords);
	}

	// 今日的用户收益总额
	@Override
	public BigDecimal selectEarningsToday() {
		return memberRevenueRecordsMapper.selectEarningsToday();
	}

	// 本月的用户收益总额
	@Override
	public BigDecimal selectEarningsMonth() {
		return memberRevenueRecordsMapper.selectEarningsMonth();
	}

	// 本月的用户收益总额
	@Override
	public BigDecimal selectEarningsSum() {
		return memberRevenueRecordsMapper.selectEarningsSum();
	}
}

